<?php


namespace app\api\validate;


use think\Validate;

class PositionScene extends Validate
{
    protected $rule = [
        'id' => ["require","number"],
        'name' => ['require','length'=>'1,10'],
        'class_id' => ['require','number'],
        "data_state" => ['number','require'],
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'name.require' => '职位名不能为空',
        'name.length' => '职位名长度为1-10个字符',
        'id.require' => '职位ID不能为空',
        'id.number' => '职位ID只能为数值',
        'class_id.require' => '分类ID不能为空',
        'class_id.number' => '分类ID只能为数值',
        'data_state.number' =>'数据状态必须为数值',
        'data_state.require' =>'未设置状态',
    ];



    protected $scene = [
        'add'  =>  ['name','class_id'],
        'update'  =>  ['id','name','class_id'],
        'update_state' => ['id',"data_state"]
    ];
}